package com.seecoder.BlueWhale.repository;

import com.seecoder.BlueWhale.po.Comment;
import com.seecoder.BlueWhale.po.Order;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface CommentRepository extends JpaRepository<Comment, Integer> {
    List<Comment> findAllByCommodityID(int id);

    Comment findByOrderID(int id);

    @Query("SELECT o FROM Comment o WHERE o.id = (SELECT MAX(o2.id) FROM Comment o2)")
    Comment findWithMaxId();
}